package controllers

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/context"
)

//json返回字符串的格式
type Message struct {
	Code int8
	Data interface{}
	Msg  string
}

//检查cookie是否登录
func CheckAccount(ctx *context.Context) bool {
	name := ctx.GetCookie("name")
	beego.Debug(name)
	if name == "" {
		return false
	}
	pwd := ctx.GetCookie("pwd")
	if pwd == "" {
		return false
	}
	return beego.AppConfig.String("name") == name &&
		beego.AppConfig.String("pwd") == pwd
}
